package game.leon.engine.net.codec;

import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

/**
 * User: bianpeng
 * Date: 11-12-27
 * Gateway上面通信用的, 所以有一个userId传递, 但是少了flag, checksum等内容
 * 上行消息, 不支持消息合并, 有一条发一条.
 * 下行需要支持消息合并
 */
public class GateCodecFactory implements ProtocolCodecFactory {
    private ProtocolEncoder encoder;
    private ProtocolDecoder decoder;
    public GateCodecFactory() {
        this.encoder = new GateProtocolEncoder();
        this.decoder = new GateProtocolDecoder();
    }
    @Override
    public ProtocolEncoder getEncoder(IoSession session) throws Exception {
        return encoder;
    }
    @Override
    public ProtocolDecoder getDecoder(IoSession session) throws Exception {
        return decoder;
    }
}
